﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace SingleBlog.Core.Data
{
    /// <summary>
    /// 设置
    /// </summary>
    [Table("Settings")]
    public class Setting
    {
        /// <summary>
        /// 设置键，必须唯一。
        /// </summary>
        [Required,StringLength(30),Key]
        public string Key { get; set; }

        /// <summary>
        /// 配置字符串。
        /// </summary>
        [Required]
        public string Configuration { get; set; }

        /// <summary>
        /// 缓存键。
        /// </summary>
        public static string CacheKey(string key) => $"setting-{key}";
    }
}
